﻿namespace LeastSquares
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var model = new compute();
            model.X = new List<double> { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 };
            model.Y= new List<double> { 1.21, 1.34, 1.47, 1.66, 1.96, 2.29, 2.75, 3.55, 4.59, 5.1, 6.09, 7.55, 8.53, 9.57, 10.48, 11.06, 11.23, 12.31, 13.89, 14.28, 14.69 };
            model.Calculate();//计算回归方程
            double GDP = model.Forecast(2021);
            Console.WriteLine($"预测2021年GDP为{GDP}");
            double tolerance = model.deviation(GDP);
            Console.WriteLine($"预测数据误差为{tolerance}");


        }
    }
}